package com.hqx.oop.myfinal;

public class FinalTest {

    public static void main(String[] args) {
//        System.out.println(addOne(1));
        Other other = new Other();
        addObe(other);
        addObe(other);
        addObe(other);
        System.out.println(other.i);
    }

    public static int  addOne(final int x) {
//        return ++x;  x已经赋值一次，无法再赋值 ++x 等价于 x = x+1;
        return x + 1;
    }

    public static void addObe(final Other o) {

        o.i++;
    }
}

class Other{
    public int i;
}
